package com.dpiinc.TechPage.user.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.dpiinc.TechPage.AIWriteApplication;

/**
 * Created by hu489_000 on 2018-07-05.
 */


/**
 * Utils
 * Created by jaycee on 2017/6/14.
 */
public class Utils {
    /**
     * 判断网络是否可用
     */
    public static boolean isNetworkAvailable() {

        ConnectivityManager cm = (ConnectivityManager) AIWriteApplication.Companion.instance().getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = cm.getActiveNetworkInfo();

        return networkInfo != null && networkInfo.isAvailable();
    }
}
